package com.mopa.allMyView;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PaintFlagsDrawFilter;
import android.graphics.Rect;
import android.os.Bundle;
import android.provider.Settings.Secure;
import android.util.Log;
public class AllMyViewActivity extends Activity {
	
    private String android_id =null;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //android_id=Secure.getString(this.getContentResolver(), Secure.ANDROID_ID);
        //System.out.println("android_id:"+android_id);
	    Paint pFont = new Paint(); 
	    Rect rect = new Rect(); 
	    String strText="SINA:4,QQ:7";
	    pFont.getTextBounds(strText, 0, strText.length(), rect); 
	    Log.v("LRView", "height:"+rect.height()+"width:"+rect.width());
	    final Resources res = this.getResources();
		Bitmap mBmLeft=BitmapFactory.decodeResource(res, R.drawable.background_lr_background_left);
		Bitmap mBmMid=BitmapFactory.decodeResource(res, R.drawable.background_lr_background_mid);
		Bitmap mBmRight=BitmapFactory.decodeResource(res, R.drawable.background_lr_background_right);
	    int outWidth=mBmLeft.getWidth()+mBmRight.getWidth()+(int)(rect.width()*1.5);
	    int outHeight=(int)(mBmMid.getHeight()*1.2);
        Bitmap outBmp = Bitmap.createBitmap(outWidth, outHeight, Config.ARGB_8888);
        Canvas canvas = new Canvas(outBmp);
        canvas.setDrawFilter(new PaintFlagsDrawFilter(0,Paint.ANTI_ALIAS_FLAG| Paint.FILTER_BITMAP_FLAG));
        canvas.drawBitmap(mBmLeft,new Rect(0,0,mBmLeft.getWidth(),mBmLeft.getHeight()),new Rect(0,0,mBmLeft.getWidth(),outHeight),null);
 		canvas.drawBitmap(mBmMid,new Rect(0,0,mBmMid.getWidth(),mBmMid.getHeight()),new Rect(mBmLeft.getWidth(),0,outWidth-mBmRight.getWidth(),outHeight),null);
 		canvas.drawBitmap(mBmRight,new Rect(0,0,mBmRight.getWidth(),mBmRight.getHeight()),new Rect(outWidth-mBmRight.getWidth(),0,outWidth,outHeight),null);
        ImageAndText mImgAndText=new ImageAndText(this, outBmp, strText);
        setContentView(mImgAndText);
    }
    
}